home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 3.5 KB | 113 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWResSin.cpp
- // Release Version: $ 1.0d11 $
- //
- // Copyright: 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef FWRESSIN_H
- #include "FWResSin.h"
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // CLASS FW_CResourceSink
- //========================================================================================
-
- #pragma segment FW_ResourceSink
-
- //----------------------------------------------------------------------------------------
- // FW_CResourceSink::FW_CResourceSink
- //----------------------------------------------------------------------------------------
-
- FW_CResourceSink::FW_CResourceSink(FW_CResource &resource) :
- fResource(resource),
- fMemorySink(resource.GetData(), resource.GetSize(), resource.GetSize())
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CResourceSink::~FW_CResourceSink
- //----------------------------------------------------------------------------------------
-
- FW_CResourceSink::~FW_CResourceSink()
- {
- FW_START_DESTRUCTOR
- fResource.ReleaseData();
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CResourceSink::Read
- //----------------------------------------------------------------------------------------
-
- void FW_CResourceSink::Read(void * destination, long count)
- {
- fMemorySink.Read(destination, count);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CResourceSink::GetWritableBytes
- //----------------------------------------------------------------------------------------
-
- long FW_CResourceSink::GetWritableBytes() const
- {
- // Resource sinks are read-only
- return 0;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CResourceSink::Write
- //----------------------------------------------------------------------------------------
-
- void FW_CResourceSink::Write(const void* ,
- long)
- {
- // Resource sinks are read-only
- FW_ASSERT(FALSE);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CResourceSink::GetLength
- //----------------------------------------------------------------------------------------
-
- long FW_CResourceSink::GetLength() const
- {
- return fMemorySink.GetLength();
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CResourceSink::SetLength
- //----------------------------------------------------------------------------------------
-
- void FW_CResourceSink::SetLength(long length)
- {
- fMemorySink.SetLength(length);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CResourceSink::GetPosition
- //----------------------------------------------------------------------------------------
-
- long FW_CResourceSink::GetPosition() const
- {
- return fMemorySink.GetPosition();
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CResourceSink::SetPosition
- //----------------------------------------------------------------------------------------
-
- void FW_CResourceSink::SetPosition(long position)
- {
- fMemorySink.SetPosition(position);
- }
-
-